/* 
5.循环数组，知道索引，根据索引从数组对象里找到自己要的对象，并且修改该对象的字段
*/
const arr = [
    { name: "张三", age: "13", isActive: false },
    { name: "李四", age: "14", isActive: true },
];

const index = 1;
arr.forEach((v, i) =>i === index ? v.isActive = true : v.isActive = false);
console.log("arr", arr);
// console
// arr [
//     { name: '张三', age: '13', isActive: false },
//     { name: '李四', age: '14', isActive: true }
//   ]